<!--
+----------------------------------------------------------------------
| 友得云客  - 开启房产营销新纪元
+----------------------------------------------------------------------
| Copyright (c) 2019~2023 优得（西安）信息科技有限公司版权所有
+----------------------------------------------------------------------
| Licensed 友得云客不是自由软件 未经允许不可移除相关版权
+----------------------------------------------------------------------
| Author: www.youdeyunke.com
+----------------------------------------------------------------------
-->
<template>
  <div v-cloak class="app-container">
    <ud-card>

        <el-tabs v-model="defaultactive" tab-position="left">
          <el-tab-pane label="联系方式" v-if="btns.update_contact_info" name="info">
            <sysInfo :config="config" @updateConfig="loadConfig"></sysInfo>
          </el-tab-pane>

          <el-tab-pane label="地图KEY" v-if="btns.update_myconfig_map" name="map">
            <sysMapkey :config="config" @updateConfig="loadConfig"></sysMapkey>
          </el-tab-pane>

          <el-tab-pane label="短信平台" v-if="btns.update_myconfig_sms" name="sms">
            <smsConfig :config="config" @updateConfig="loadConfig"></smsConfig>
          </el-tab-pane>

          <el-tab-pane label="积分规则" v-if="btns.update_myconfig_jifen" name="score_config">
            <score-config></score-config>
          </el-tab-pane>

          <el-tab-pane label="页面查询" v-if="btns.update_myconfig_pageurl" name="path">
            <pageQuery></pageQuery>
          </el-tab-pane>

          <el-tab-pane label="文件管理" v-if="btns.update_myconfig_file" name="media">
            <user-media></user-media>
          </el-tab-pane>

          <el-tab-pane label="厂房标签" v-if="btns.update_myconfig_posttag" name="tag">
            <tags></tags>
          </el-tab-pane>

          <el-tab-pane label="城市设置" v-if="btns.update_myconfig_cities" name="address">
            <CityAddress></CityAddress>
          </el-tab-pane>

          <el-tab-pane label="枚举值管理" v-if="btns.update_myconfig_enum" name="Enumerations">
            <Enumerations></Enumerations>
          </el-tab-pane>

          <el-tab-pane label="服务器参数" v-if="btns.update_myconfig_server" name="base">
            <serverConfig :config="config" @updateConfig="loadConfig"></serverConfig>
          </el-tab-pane>

          <el-tab-pane label="短信记录" v-if="btns.update_myconfig_smslog" name="smsLog">
            <Sms></Sms>
          </el-tab-pane>

          <el-tab-pane label="定时任务" v-if="btns.update_myconfig_cronjob" name="cronJob">
            <Job></Job>
          </el-tab-pane>

          <el-tab-pane label="网站设置" v-if="btns.update_seo_config" name="website">
            <WebsiteConfig></WebsiteConfig>
          </el-tab-pane>

        </el-tabs>
    </ud-card>
  </div>
</template>

<style lang="scss" scoped>
.help-text {
  color: #666666;
  font-size: 12px;
}
</style>

<script>
import HelpIcon from "@/components/HelpIcon";
import UserMedia from "@/components/MediaManager/UserMedia";
import UdCard from "@/components/UdCard";
import { mapGetters } from "vuex";
import CityAddress from "./address/index.vue";
import Enumerations from "./enumerations/index.vue";
import sysInfo from './info/index.vue';
import Job from "./job/index.vue";
import sysMapkey from './mapkey/index.vue';
import pageQuery from './pageQuery/index.vue';
import ScoreConfig from "./ScoreConfig/index.vue";
import serverConfig from './serverConfig/index.vue';
import Sms from "./sms/index.vue";
import smsConfig from './smsConfig/index.vue';
import Tags from "./tags/index.vue";
import WebsiteConfig from "./WebsiteConfig/index.vue";

export default {
  components: {
    UdCard,
    HelpIcon,
    ScoreConfig,
    UserMedia,
    Tags,
    CityAddress,
    sysInfo,
    sysMapkey,
    smsConfig,
    pageQuery,
    serverConfig,
    Enumerations,
    Sms,
    Job,
    WebsiteConfig,
  },

  props: {
    btns: { type: Object, default: null },
  },

  data() {
    return {
      defaultactive: "info",
      loading: false,
      config: {},
    };
  },
  created() { },
  watch: {

  },
  computed: {
    ...mapGetters(["user"]),

  },

  mounted: function () {
    this.loadConfig();
  },

  methods: {



    loadConfig: function () {
      this.loading = true;
      this.$store.dispatch("myconfig/loadMyconfig").then((config) => {
        this.loading = false;
        this.config = config;
      });
    },
  },
};
</script>
